package lock.lntelligence.gjx.fragment;

import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import lock.lntelligence.gjx.R;
import lock.lntelligence.gjx.activity.DoActivity;
import lock.lntelligence.gjx.activity.LockActivity;

public class OpenLockFragment extends Fragment implements View.OnClickListener {

    private View mInflate;
    private TextView mTextView_open;

    public OpenLockFragment() {
        // Required empty public constructor
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {
        // Inflate the layout for this fragment
        if (mInflate==null) {
            mInflate = inflater.inflate(R.layout.fragment_open_lock, null);
            findID();
            setListener();
        }
        return mInflate;
    }

    private void setListener() {
        mTextView_open.setOnClickListener(this);
    }

    private void findID() {
        mTextView_open = (TextView) mInflate.findViewById(R.id.textView_open);
    }

    @Override
    public void onClick(View view) {
        switch (view.getId()){
            case R.id.textView_open:
                Intent intent = new Intent();
                intent.setClass(getActivity(), LockActivity.class);
                intent.putExtra("sleep","sleep");
                intent.putExtra("open","open");
                ((DoActivity)getActivity()).isNotSleep = false ;
                startActivity(intent);
                break;
        }
    }

}
